<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>登录</title>
  <link rel="stylesheet" href="/static/css/login.css" type="text/css">
</head>
<body>
<div class="container">
    <!-- 登录表单 -->
    <form method="post" action="/login" onsubmit="return validateForm()">
      <h2 class="title">欢迎登录</h2>
      {{if .error}}
      <div class="error-message">{{.error}}</div>
      {{end}}
      <div class="input-group">
        <label for="email">电子邮箱</label>
        <input type="email" id="email" name="email" required>
      </div>
      <div class="input-group">
        <label for="password">密码</label>
        <input type="password" id="password" name="password" required>
      </div>
      <button type="submit" class="button">立即登录</button>
      <div class="toggle-form">
        没有账号? <a href="/register">立即注册</a>
      </div>
    </form>
  </div>

  <script>
    function validateForm() {
      const email = document.getElementById('email').value;
      const password = document.getElementById('password').value;
      
      if (!email || !password) {
        alert('邮箱和密码不能为空');
        return false;
      }
      
      return true;
    }
  </script>
</body>
</html>